#!/usr/bin/env python

# -------
# Imports:
# -------
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
from settings import *
from core.models import *

# ------------------------------------
class UploadView(webapp.RequestHandler):
# ------------------------------------
    # -----------
    def get(self):
    # -----------
        # Query for the last 10 source images
        imageQuery = Image.all()
        imageQuery.order('-uploaded')
        images = imageQuery.fetch(10)
        for image in images:
            image.id = image.key().id()
 
        path = os.path.join(TEMPLATE_DIR, 'upload.html')
        self.response.out.write(template.render(path, {'current': 'upload', 'images': images}))
